package org.easydarwin.easyplayer.zhi;

import android.content.Context;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;

import butterknife.ButterKnife;

public abstract class BaseActivity extends AppCompatActivity {

    protected Context context;




    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(setLayoutId());
        //绑定控件
        ButterKnife.bind(this);

        context = this;
        //初始化沉浸式
        if (isImmersionBarEnabled())
            initImmersionBar();
        initViewsAndEvents();
    }

    public abstract int setLayoutId();


    public abstract void initViewsAndEvents();

    /**
     * 是否可以使用沉浸式
     * Is immersion bar enabled boolean.
     *
     * @return the boolean
     */
    protected boolean isImmersionBarEnabled() {
        return true;
    }

    protected void initImmersionBar() {
        //在BaseActivity里初始化

    }

    @Override
    protected void onDestroy() {

        super.onDestroy();

    }

//
//    public <T> void getHttp(RxSubscribe<T> subscriber, String url, Map<String, String> map) {
//        Observable observable = apiService.executeGet(url, map)
//                .map(new HttpResultFunc());
//        toSubscribe(observable, subscriber);
//    }


//    public <T> void postHttp(RxSubscribe<T> subscriber, String url, Map<String, String> map) {
//        Observable observable = apiService.executePost(url, map)
//                .map(new HttpResultFunc());
//        toSubscribe(observable, subscriber);
//    }




}
